package com.cathyjava.crawl.controller;

import com.cathyjava.crawl.service.CrawService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author chenjing
 * @date 2021/4/14
 */
@Controller
public class CrawlController {
    @Autowired
    CrawService crawService;

    @GetMapping("/demo")
    public String demo() {
        return "crawl/demo";
    }

    @GetMapping({""})
    public String home() {
        return "crawl/index";
    }

    @RequestMapping("/openOrClose")
    @ResponseBody
    public void openOrClose(int id, Byte status) {
        crawService.openOrCloseCrawl(id, status);
    }
}
